package com.sdap2.dao;

import com.sdap2.common.dao.LogicDAO;
import com.sdap2.entity.CameraData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.Optional;

@Repository
public interface CameraDataDAO extends LogicDAO<CameraData, Long> {
    // 根据设备ID查询抓拍记录
    Page<CameraData> findAllByDeviceId(Long deviceId, Pageable pageable);
    
    // 根据设备ID和时间范围查询抓拍记录
    Page<CameraData> findAllByDeviceIdAndCreateTimeBetween(
            Long deviceId, 
            java.time.LocalDateTime startTime, 
            java.time.LocalDateTime endTime, 
            Pageable pageable);

    // 获取最新一条记录
    Optional<CameraData> findFirstByDeviceIdOrderByCreateTimeDesc(Long deviceId);

    void deleteByDeviceId(Long deviceId);
} 